package com.cml.rpc.client;


import com.cml.rpc.publicinterface.UserService;
import com.cml.rpc.publicpojo.User;

/**
 *  客户端调用
 * @author cml
 * @create 2021/7/20 15:20
 * 实现客户端调用同一接口不同方法
 */
public class RpcClient {
    public static void main(String[] args) {
        ClientProxy clientProxy = new ClientProxy("127.0.0.1", 8877);
        System.out.println("客户端启动.....");
        // 获取代理对象
        UserService proxy = clientProxy.getProxy(UserService.class);

        System.out.println("客户端调用UserService.getUserById........");
        User user = proxy.getUserById(123);
        System.out.println("接收来自服务端的user = " + user);

        System.out.println("客户端调用UserService.insertUser........");
        Integer result = proxy.insertUser(new User(1,"cml","12"));
    }
}
